// 过滤特殊字符
function stripscript(s) {
    var pattern = new RegExp(
      "[`~!@#$^&*()=|{}':;',\\[\\].<>/?~！@#￥……&*（）&mdash;—|{}【】‘；：”“'。，、？]"
    );
    var rs = "";
    for (var i = 0; i < s.length; i++) {
      rs = rs + s.substr(i, 1).replace(pattern, "");
    }
    return rs;
  }
  // 验证邮箱
  function validateEmail(value) {
    let reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
    return !reg.test(value);
  }
  // ：验证密码 6至20位的字母+数字
  function validatePass(value) {
    let reg = /^(?!\D+$)(?![^a-zA-Z]+$)\S{6,20}$/;
    return reg;
  }
  //  二维码
  function validateCode(value) {
    let reg = /^[a-z0-9]{6}$/;
    return !reg.test(value);
  }
  // 身份证
  function validatePeople(value) {
    let reg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
    return !reg.test(value);
  }
  // 手机号
  function validatePhone(value) {
    let reg = /^1(3[0-9]|5[0-3,5-9]|7[1-3,5-8]|8[0-9])\d{8}$/;
    return !reg.test(value);
  }
  
  export {
    stripscript,
    validateEmail,
    validatePass,
    validateCode,
    validatePeople,
    validatePhone
  };
  